package com.winning.java.action;

import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import java.io.Console;

/**
 * @author: rqx
 * @create: 2023/6/5 10:21
 * @description:
 */
@Slf4j
public class Main {
    @Test
    public void ActionTest() {

        var mouse = new AnimalWithAction("mouse");

        var cat = new AnimalWithAction("cat") {
            @Override
            public void eat(BaseAction obj) {
                log.info("\teat {}", obj.getName());
            }

            @Override
            public String catchObj(BaseAction obj) {
                return String.format("\tcan catch %s", obj.getName());
            }
        };
        cat.Info(mouse);


        var dog = new AnimalWithAction("dog") {
            @Override
            public void eat(BaseAction obj) {
                log.info("\tdon't eat {}", obj.getName());
            }

            @Override
            public String catchObj(BaseAction obj) {
                return String.format("\tplay with %s", obj.getName());
            }
        };
        dog.Info(cat);

    }
}
